package VarParameter;

public class VarParameterDetail {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4};
        Test t = new Test();
        int ret = t.getSum(arr);
        System.out.println(ret);
    }

}
//测试类
class Test {
    int getSum(int... nums) {
        int res = 0;
        for (int num : nums) {
            res += num;
        }
        return res;
    }
    //测试参数列表
    int test02(String s, int... nums) {

        System.out.println(s);
        int res = 0;

        for (int num : nums) {
            res += num;
        }
        return res;
    }

}
